<template>
  <basic-container>
		<dataList
			placeholder="请输入考核名称"
			:pageInfo="pager"
			:listData="tableData"
			searchName="assessName"
			:menuList="['add']"
			:filterList="filterList"
			@menu-click="handleMenuClick"
		>
			<el-table :data="tableData" align="center">
				<el-table-column center label="考核编号" prop="assessCode"></el-table-column>
				<el-table-column label="考核名称" prop="assessName"></el-table-column>
				<el-table-column label="类别" prop="assessCata">
					<template slot-scope="scope">{{scope.row.assessCata|dict('assess_cata')}}</template>
				</el-table-column>
				<el-table-column label="考核开始时间" prop="startTime"></el-table-column>
				<el-table-column label="考核结束时间" prop="endTime"></el-table-column>
				<el-table-column label="状态" prop="status">
					<template slot-scope="scope">{{scope.row.status|dict('assess_status')}}</template>
				</el-table-column>
				<el-table-column label="操作" width="200px">
					<template slot-scope="scope">
						<div style="float:left">
							<el-button type="text" @click="view(scope.row.assessTaskId)">查看</el-button>
						</div>
						<div v-if="scope.row.status=='00'" style="float:left">
							<span class="btn-line"></span>
							<el-button type="text" @click="edit(scope.row.assessTaskId)">编辑</el-button>
							<span class="btn-line"></span>
							<el-button type="text" @click="del(scope.row.assessTaskId)">删除</el-button>
						</div>
						<div v-if="scope.row.status=='01'" style="float:left">
							<span class="btn-line"></span>
							<el-button type="text" @click="closeAssess(scope.row)">结束考核</el-button>
						</div>
					</template>
				</el-table-column>
			</el-table>
		</dataList>

    <el-dialog title="新增考核" :visible.sync="dialogVisible" :modal-append-to-body="false" :close-on-click-modal="false" width="85%" :before-close="handleClose">
      <el-row>
        <el-form class="form-wrap" :model="formData" size="small" ref="formData" :rules="rules">
          <el-form-item label="考核编号" prop="assessCode">
            <br />
            <div v-text="formData.assessCode" class="labelFont"></div>
          </el-form-item>
          <el-form-item label="考核名称" prop="assessName">
            <span>
              <el-input v-model="formData.assessName" maxlength="32" placeholder="请输入考核名称"></el-input>
            </span>
          </el-form-item>
          <el-form-item label="类别" prop="assessCata">
            <br />
            <el-select v-model="formData.assessCata" placeholder="请选择">
              <el-option v-for="item in assess_cata" :key="item.value" :label="item.label" :value="item.value"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="考核模板" prop="assessTemplateId">
            <br />
            <el-select v-model="formData.assessTemplateId" placeholder="请选择">
              <el-option v-for="item in assessTemplate" :key="item.value" :label="item.label" :value="item.value"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="考核单位(不选默认选择全部单位)" prop="customerNames">
            <el-row>
              <el-button @click="selectApplyUnit">选择考核单位</el-button>
              <apply-unit-select ref="applyUnitSelect" @completeSelect="completeSelect4"></apply-unit-select>
            </el-row>
            <el-row>
              <span :title="customerNames">{{customerNames!=null && customerNames.length>30?customerNames.substr(0,30)+"...":customerNames}}</span>
            </el-row>
          </el-form-item>
          <el-form-item label="考核时间段" prop="value">
            <el-date-picker
              v-model="value"
              type="daterange"
              range-separator="至"
              start-placeholder="开始日期"
              format="yyyy-MM-dd"
              value-format="yyyy-MM-dd"
              end-placeholder="结束日期"
            ></el-date-picker>
          </el-form-item>
          <el-form-item label="及格分数" prop="scoreLevel1">
            <br />
            <span>
              <el-input-number v-model="formData.scoreLevel1" :min="0" :max="100" placeholder="请输入"></el-input-number>
            </span>
          </el-form-item>
          <el-form-item label="考核时间" prop="assessDate">
            <el-date-picker v-model="formData.assessDate" type="date" value-format="yyyy-MM-dd" placeholder="选择考核日期"></el-date-picker>
          </el-form-item>
        </el-form>
      </el-row>
      <span slot="footer" class="dialog-footer">
        <el-button @click="cancel">取 消</el-button>
        <el-button type="primary" v-throttle="[save]">保 存</el-button>
        <el-button type="primary" v-throttle="[saveAndSend]">保存并发送</el-button>
      </span>
    </el-dialog>

    <el-dialog title="查看考核" :visible.sync="dialogVisible2" :modal-append-to-body="true" :append-to-body="true" :close-on-click-modal="false" width="85%">
      <div class="card-title">基本信息</div>
      <el-row>
        <el-form class="form-wrap" :model="formData2" size="small">
          <el-form-item label="考核编号">
            <span>{{formData2.assessCode}}</span>
          </el-form-item>
          <el-form-item label="考核名称">
            <span>{{formData2.assessName}}</span>
          </el-form-item>
          <el-form-item label="类别">
            <span>{{formData2.assessCata|dict('assess_cata')}}</span>
          </el-form-item>
          <el-form-item label="考核模板">
            <span>{{assessTemplateName}}</span>
          </el-form-item>
          <el-form-item label="考核单位">
            <span>{{formData2.customerNames}}</span>
          </el-form-item>
          <el-form-item label="考核开始时间" prop="value">
            <span>{{formData2.startTime}}</span>
          </el-form-item>
          <el-form-item label="考核结束时间">
            <span>{{formData2.endTime}}</span>
          </el-form-item>
          <el-form-item label="及格分数">
            <span>{{formData2.scoreLevel1}}</span>
          </el-form-item>
          <el-form-item label="考核时间">
            <span>{{formData2.assessDate}}</span>
          </el-form-item>
        </el-form>
      </el-row>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible2 = false">取 消</el-button>
        <el-button type="primary" @click="dialogVisible2 = false">确 定</el-button>
      </span>
    </el-dialog>
  </basic-container>
</template>
<script src="./list.js"></script>

<style lang="scss" scoped>
@include formWrap();
</style>
